home *** CD-ROM | disk | FTP | other *** search
- XXX - Not complete yet!!!
-
- Name
-
- SGIX_pipeline_instruments
-
- Name Strings
-
- GL_SGIX_pipeline_instruments
-
- Version
-
- $Date: 1996/04/01 23:23:04 $ $Revision: 1.1 $
-
- Number
-
- 55
-
- Dependencies
-
- None
-
- Overview
-
- This extension allows the gathering and return of performance measurements
- from within the graphics pipeline by adding instrumentation.
-
- There are two reasons to do this. The first is as a part of some type of
- fixed-frame-rate load management scheme. If we know that the pipeline is
- stalled or struggling to process the amount of data we have given it so
- far, we can reduce the level of detail of the remaining objects in the
- current frame or the next frame, or adjust the framebuffer resolution for
- the next frame if we have a video-zoom capability available. We can call
- this type of instrumentation Load Monitoring.
-
- The second is for performance tuning and debugging of an application. It
- might tell us how many triangles were culled or clipped before being
- rasterized. We can call this simply Tuning.
-
- Load Monitoring requires that the instrumentation and the access of the
- measurements be efficient, otherwise the instrumentation itself will reduce
- performance more than any load-management scheme could hope to offset.
- Tuning does not have the same requirements.
-
- While the RE had some experimental Tuning instrumentation implemented in
- software at a great performance penalty,
- Kona is the first machine to provide instrumentation registers that do not
- affect performance while they are gathering data.
- The only cost is in accessing them.
- The BEF (Back End (of GE board) Fifo) chip has six registers
- which are described completely in the BEF spec.
- The BEF sits in the pipeline just above where rasterization begins.
- We list the registers here for convenience:
-
- BEF_PERF_COUNTALL, a free running counter of Tbus cycles
- BEF_PERF_COUNTDRAW, cycles spent writing drawing information
- BEF_PERF_COUNTLOAD, cycles spent writing a texture
- BEF_PERF_COUNTEMPTY, cycles spent writing nothing
- BEF_PERF_MAILBOX_TIMESTAMP, when MAILBOX is written to, COUNTALL is
- stored here.
- BEF_PERF_MAILBOX, a seq id may be written to this register
-
- Given the values derived from a register write to store the COUNTALL value
- into the MAILBOX and three writes to zero COUNTDRAW,COUNTLOAD and
- COUNTEMPTY, and one access to get the values back:
-
- cycles spent being host-limited = BEF_PERF_COUNTEMPTY.
- cycles spent being fill-limited = BEF_PERF_COUNTALL - BEF_PERF_COUNTDRAW -
- BEF_PERF_COUNTLOAD - BEF_PERFCOUNTEMPTY
-
- The BEF1 chip as implemented has a bug, the BEF_PERFCOUNTEMPTY register
- counts all cycles in which we wrote nothing, rather than only the cycles
- in which the destination of the write was ready _and_ we had nothing to
- write to it. Thus, the system will appear as if it is always
- host/GE-limited if this error is not taken into account.
-
- The proposed extension adds a call to setup a measurements return buffer,
- similar to FeedbackBuffer but with an asynchrounous behavior to prevent
- filling the pipeline with NOP's while waiting for the data to be returned.
-
- The proposed new procedures and functions and an example of their use is
- given below:
-
- New Procedures and Functions
-
- void PipelineInstrumentsBufferSGIX(sizei size, GLfloat *buffer)
-
- GLint StartInstrumentsSGIX(void);
-
- void StopInstrumentsSGIX(void);
-
- GLint PollInstrumentsSGIX(int seq_id);
-
- GLint GetInstrumentsSGIX(int seq_id);
-
- The anticipated usage is as follows:
- {
-
- #ifdef GL_SGIX_pipeline_instruments
-
- static double buffer[8]; /* HIP has bug, needs to be double-aligned */
- int id0,id1;
- int count0,count1;
- unsigned int *p;
- int i;
- int sim;
-
- if (!strstr((const char *)glGetString(GL_EXTENSIONS),"GL_SGI_pipeline_instrument"))
- ogEnvLog(1, "This test requires the pipeline_instrument extension");
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glMatrixMode(GL_PROJECTION);
- glOrtho(0.0,2.0,0.0,2.0,1.0,-1.0);
-
- glPipelineInstrumentsBufferSGIX(sizeof(buffer)/sizeof(GLfloat), (GLfloat *) buffer);
-
- glEnable(GL_BEF_INSTRUMENT1_SGIX);
-
- id0 = glStartInstrumentsSGIX();
- /* Try to make this one fill limited */
- for (i = 0; i < 300; i++) drawmesh(2.,2.,1,1,0x00ff00ff);
- glStopInstrumentsSGIX();
-
- id1 = glStartInstrumentsSGIX();
- /* Try to make this one GE/host limited */
- for (i = 0; i < 10; i++) drawmesh(2.,2.,320,240,0xff0000ff);
- glStopInstrumentsSGIX();
-
- while (!glPollInstrumentsSGIX(id0)) ;
- while (!glPollInstrumentsSGIX(id1)) ;
-
- count0 = glGetInstrumentsSGIX(id0);
- count1 = glGetInstrumentsSGIX(id1);
-
- #define ID 0
- #define COUNT 1
- #define COUNTEMPTY 2
- #define COUNTDRAW 3
- #define COUNTLOAD 4
- #define MAILBOX_TIMESTAMP 5
- #define COUNTALL 6
- #define MAILBOX 7
-
- p = (unsigned int *) buffer;
- if (p[ID] != GL_BEF_INSTRUMENT1_SGIX)
- ogEnvLog(OG_LFAIL,"FAIL first element of buffer should be GL_BEF_INSTRUMENT1_SGIX\n");
- if (p[COUNT] != 6)
- ogEnvLog(OG_LFAIL,"FAIL second element of buffer should be 6\n");
-
- if (getenv("PRINT_PIPELINE_INSTRUMENTS")){
- fprintf(stderr,"count0 = %d, count1 = %d\n\n",count0,count1);
-
- fprintf(stderr,"p[COUNTALL] = 0x%08x = %u\n",p[COUNTALL],p[COUNTALL]);
- fprintf(stderr,"p[COUNTDRAW] = 0x%08x = %u\n",p[COUNTDRAW],p[COUNTDRAW]);
- fprintf(stderr,"p[COUNTLOAD] = 0x%08x = %u\n",p[COUNTLOAD],p[COUNTLOAD]);
- fprintf(stderr,"p[COUNTEMPTY] = 0x%08x = %u\n",p[COUNTEMPTY],p[COUNTEMPTY]);
- fprintf(stderr,"p[MAILBOX_TIMESTAMP] = 0x%08x = %u\n",p[MAILBOX_TIMESTAMP],p[MAILBOX_TIMESTAMP]);
-
- fprintf(stderr,"total cycles: = %d\n",p[COUNTALL]-p[MAILBOX_TIMESTAMP]);
- fprintf(stderr,"host-limited cycles: = %u\n",p[COUNTEMPTY]);
- fprintf(stderr,"fill-limited cycles: = %d\n",
- p[COUNTALL] - p[MAILBOX_TIMESTAMP] - p[COUNTDRAW] - p[COUNTLOAD] - p[COUNTEMPTY]);
- fprintf(stderr,"useful cycles: = %u\n",p[COUNTDRAW] + p[COUNTLOAD]);
-
- p+= count0;
- fprintf(stderr,"p[COUNTALL] = 0x%08x = %u\n",p[COUNTALL],p[COUNTALL]);
- fprintf(stderr,"p[COUNTDRAW] = 0x%08x = %u\n",p[COUNTDRAW],p[COUNTDRAW]);
- fprintf(stderr,"p[COUNTLOAD] = 0x%08x = %u\n",p[COUNTLOAD],p[COUNTLOAD]);
- fprintf(stderr,"p[COUNTEMPTY] = 0x%08x = %u\n",p[COUNTEMPTY],p[COUNTEMPTY]);
- fprintf(stderr,"p[MAILBOX_TIMESTAMP] = 0x%08x = %u\n",p[MAILBOX_TIMESTAMP],p[MAILBOX_TIMESTAMP]);
-
- fprintf(stderr,"total cycles: = %d\n",p[COUNTALL]-p[MAILBOX_TIMESTAMP]);
- fprintf(stderr,"host-limited cycles: = %u\n",p[COUNTEMPTY]);
- fprintf(stderr,"fill-limited cycles: = %d\n",
- p[COUNTALL] - p[MAILBOX_TIMESTAMP] - p[COUNTDRAW] - p[COUNTLOAD] - p[COUNTEMPTY]);
- fprintf(stderr,"useful cycles: = %u\n",p[COUNTDRAW] + p[COUNTLOAD]);
- }
- #endif
- }
-
- New Tokens
-
- Accepted by the <cap> parameter of Enable, Disable and IsEnabled:
-
- BEF_INSTRUMENT1_SGIX
-
-
- Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation)
-
- None
-
- Additions to Chapter 3 of the 1.0 Specification (Rasterization)
-
- None
-
- Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations
- and the Frame Buffer)
-
- None
-
- Additions to Chapter 5 of the 1.0 Specification (Special Functions)
-
- The following commands are not included in display lists:
-
- PipelineInstrumentsBufferSGIX
- StartInstrumentsSGIX
- StopInstrumentsSGIX
- PollInstrumentsSGIX
- GetInstrumentsSGIX
-
- Additions to Chapter 6 of the 1.0 Specification (State and State Requests)
-
- None
-
- Additions to the GLX Specification
-
- None
-
- GLX Protocol
-
- XXX - not yet complete
-
- Errors
-
- XXX - not yet complete
-
- New State
-
- None
-
- New Implementation Dependent State
-
- None
-